package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.entity.SkinOrderListEntity;
import com.zw.yzk.kabu.model.SkinModel;

import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by skydar on 2017/4/14.
 */

public class SkinOrderListMapper {

    @Inject
    public SkinOrderListMapper() {

    }

    public SkinModel transfer(SkinOrderListEntity.SkinOrderEntity cover) {
        SkinModel model = new SkinModel();
        model.setId(cover.id);
        model.setOrderId(cover.orderId);
        model.setName(cover.name);
        model.setCoverPath(cover.coverPath);

        return model;
    }

    public List<SkinModel> transfer(SkinOrderListEntity entity) {
        List<SkinModel> models = new ArrayList<>();
        if(entity.result.coverList == null || entity.result.coverList.isEmpty()) {
            return models;
        }
        for(SkinOrderListEntity.SkinOrderEntity cover : entity.result.coverList) {
            models.add(transfer(cover));
        }
        return models;
    }
}
